home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / security / xinetd / str.1.2.0 / strparse.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-12-14  |  1.5 KB  |  55 lines

  1. /*
  2.  * (c) Copyright 1992 by Panagiotis Tsirigotis
  3.  * All rights reserved.  The file named COPYRIGHT specifies the terms 
  4.  * and conditions for redistribution.
  5.  */
  6.  
  7.  
  8. /*
  9.  * $Id: strparse.h,v 1.1 1992/10/01 00:29:01 panos Exp $
  10.  */
  11.  
  12. struct str_handle
  13. {
  14.    char *string ;
  15.    char *separator ;
  16.    char *pos ;
  17.    int flags ;
  18.    int *errnop ;
  19.    int no_more ;
  20. } ;
  21.  
  22. int str_errno ;
  23.  
  24. #ifndef NULL
  25. #define NULL         0
  26. #endif
  27.  
  28. #ifndef FALSE
  29. #define FALSE        0
  30. #define TRUE         1
  31. #endif
  32.  
  33. #define PRIVATE        static
  34.  
  35. #define TERMINATE( msg )   {                                         \
  36.                               char *s = msg ;                        \
  37.                                                                      \
  38.                               (void) write( 2, s, strlen( s ) ) ;    \
  39.                               (void) abort() ;                       \
  40.                               _exit( 1 ) ;                           \
  41.                               /* NOTREACHED */                       \
  42.                            }
  43.  
  44.  
  45. #define HANDLE_ERROR( flags, retval, errp, errval, msg )    \
  46.             if ( flags & STR_RETURN_ERROR )                 \
  47.             {                                               \
  48.                *errp = errval ;                             \
  49.                return( retval ) ;                           \
  50.             }                                               \
  51.             else                                            \
  52.                TERMINATE( msg )
  53.  
  54.  
  55.